package org.jeecg.modules.phone.controller;

import java.io.*;
import java.util.*;
import java.net.URLDecoder;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.*;
import org.jeecg.common.util.oss.OssBootUtil;
import org.jeecg.modules.acmd.service.IAcmdService;
import org.jeecg.modules.aliyun.entity.run.SpringContextUtil;
import org.jeecg.modules.aliyun.entity.service.IEntityTaskService;
import org.jeecg.modules.oss.entity.OssFile;
import org.jeecg.modules.oss.service.IOssFileService;
import org.jeecg.modules.phone.entity.*;
import org.jeecg.modules.phone.enums.EntityEnums;
import org.jeecg.modules.phone.enums.TaskEnums;
import org.jeecg.modules.phone.mapper.PhoneEntityCmdMapper;
import org.jeecg.modules.phone.mapper.PhoneEntityTaskRsourceMapper;
import org.jeecg.modules.phone.service.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.system.util.*;
import org.jeecg.modules.system.vo.ResultVo;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import static org.jeecg.modules.acmd.config.Config.adbRootPath;
import static org.jeecg.modules.system.util.PhotoDigest.getData;

/**
 * @Description: 实体手机管理
 * @Author: jeecg-boot
 * @Date:   2022-08-29
 * @Version: V1.0
 */
@Slf4j
@Api(tags="实体手机管理")
@RestController
@RequestMapping("/phone/phoneEntity")
public class PhoneEntityController extends JeecgController<PhoneEntity, IPhoneEntityService> {
	@Autowired
	private IPhoneEntityService phoneEntityService;
	 
	 @Autowired
	 IAcmdService acmdService;
	 @Autowired
	 IPhoneAccountTaskService phoneAccountTaskService;

	 @Autowired
	 IPhoneAccountLogService phoneAccountLogService;

	 @Autowired
	 IEntityTaskService taskService;

	 @Autowired
	 IPhoneEntityCmdService phoneEntityCmdService;

	@Autowired
	IPhoneEntityTaskService phoneEntityTaskService;

	 @Autowired
	 IOssFileService ossFileService;
	@Autowired
	private RedisUtil redisUtil;

	/**
	 * 分页列表查询
	 *
	 * @param phoneEntity
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	@AutoLog(value = "实体手机管理-分页列表查询")
	@ApiOperation(value="实体手机管理-分页列表查询", notes="实体手机管理-分页列表查询")
	@GetMapping(value = "/list")
	public JSONObject  queryPageList(PhoneEntity phoneEntity,
									 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
									 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
									 HttpServletRequest req) {
		QueryWrapper<PhoneEntity> queryWrapper = QueryGenerator.initQueryWrapper(phoneEntity, req.getParameterMap());
		Page<PhoneEntity> page = new Page<PhoneEntity>(pageNo, pageSize);
		IPage<PhoneEntityVo> pageList = phoneEntityService.searchList(page, queryWrapper);

		return ResultUtils.ResultOkFromPage(pageList);
	}
	
	/**
	 * 添加
	 *
	 * @param phoneEntity
	 * @return
	 */
	@AutoLog(value = "实体手机管理-添加")
	@ApiOperation(value="实体手机管理-添加", notes="实体手机管理-添加")
	@PostMapping(value = "/add")
	public JSONObject add(@RequestBody PhoneEntity phoneEntity) {


		phoneEntity.setEntityStatus(EntityEnums.EntityStatus.OFFLINE.getName());
		phoneEntity.setUpdateBy(sysUtils.serverName);
		phoneEntityService.save(phoneEntity);
		AccountLog(phoneEntity.getEntityIp(), "注册实体机:"+ phoneEntity.getEntityName());
		return ResultUtils.ResultOk("添加成功！");
	}



	/**
	 * 执行
	 *
	 * @param idsVo
	 * @return
	 */
	@AutoLog(value = "实体手机管理-执行")
	@ApiOperation(value="实体手机管理-执行", notes="实体手机管理-执行")
	@PostMapping(value = "/run")
	public JSONObject run(@RequestBody IdsVo idsVo) {
		List<String> entityList = Arrays.asList(idsVo.getIds().split(","));
		phoneEntityService.run(entityList);
		return ResultUtils.ResultOk("添加成功！");
	}



	/**
	 * 关闭
	 *
	 * @param idsVo
	 * @return
	 */
	@AutoLog(value = "实体手机管理-关闭")
	@ApiOperation(value="实体手机管理-关闭", notes="实体手机管理-关闭")
	@PostMapping(value = "/stop")
	public JSONObject stop(@RequestBody IdsVo idsVo) {
		List<String> entityList = Arrays.asList(idsVo.getIds().split(","));
		phoneEntityService.stop(entityList);
		return ResultUtils.ResultOk("添加成功！");
	}


	/**
	 * 一键开启
	 *
	 * @param
	 * @return
	 */
	@AutoLog(value = "实体手机管理-一键开启")
	@ApiOperation(value="实体手机管理-一键开启", notes="实体手机管理-一键开启")
	@PostMapping(value = "/runAll")
	public JSONObject runAll( ) {
		phoneEntityTaskService.remove(new QueryWrapper<PhoneEntityTask>().eq("1","1"));

		phoneEntityService.update(new PhoneEntity().setEntityStatus(EntityEnums.EntityStatus.ONLINE.getName())
				,new QueryWrapper<PhoneEntity>().lambda());


		LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		String userId = loginUser.getId();
		String username = loginUser.getUsername();
		List<PhoneEntity> list = phoneEntityService.list(new QueryWrapper<PhoneEntity>().lambda().eq(PhoneEntity::getCreateBy, username));
		AtomicReference<String> tmp  = new AtomicReference<>("");
		list.forEach(v->{
			tmp.set(tmp + "," + v.getId());
		});
		List<String> entityList = Arrays.asList(tmp.get().split(","));
		phoneEntityService.run(entityList);
		return ResultUtils.ResultOk("添加成功！");
	}


	/**
	 * 一键停止
	 *
	 * @param
	 * @return
	 */
	@AutoLog(value = "实体手机管理-一键停止")
	@ApiOperation(value="实体手机管理-一键停止", notes="实体手机管理-一键停止")
	@PostMapping(value = "/stopAll")
	public JSONObject stopAll( ) {
		LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		String userId = loginUser.getId();
		String username = loginUser.getUsername();
		List<PhoneEntity> list = phoneEntityService.list(new QueryWrapper<PhoneEntity>().lambda().eq(PhoneEntity::getCreateBy, username));
		AtomicReference<String> tmp  = new AtomicReference<>("");
		list.forEach(v->{
			tmp.set(tmp + "," + v.getId());
		});
		List<String> entityList = Arrays.asList(tmp.get().split(","));
		phoneEntityService.stop(entityList);
		return ResultUtils.ResultOk("添加成功！");
	}


//	 /**
//	  * 获取IP
//	  *
//	  * @param
//	  * @return
//	  */
//	 @AutoLog(value = "实体手机管理-获取IP")
//	 @ApiOperation(value="实体手机管理-获取IP", notes="实体手机管理-获取IP")
//	 @PostMapping(value = "/getIp")
//	 public JSONObject getIp( ) {
//
//		 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
////		 初始化adb工具
//		   acmdService.doCmd(    "adb kill-server");
//		   acmdService.doCmd(    "adb start-server");
////		 初始化adb工具
//		 String adb_if_config
////				 = acmdService.doCmd("adb shell ifconfig wlan0 |findstr addr");
//				 = acmdService.doCmd("adb shell ifconfig eth0 |findstr addr");
//
//		 System.out.println(adb_if_config);
//		 String str = adb_if_config;
//		 String pattern = "inet addr:(\\S*)  Bcast:";
//
//		 Pattern r = Pattern.compile(pattern);
//		 Matcher m = r.matcher(str);
//		 String ip="";
//		 if(m.find()){
//			  ip = m.group().replace("inet addr:", "").replace("  Bcast:", "");
//			 String finalIp = ip;
//			 new Thread(( )-> {
////				 test 并保存一张截图
//				  acmdService.doCmd("adb  tcpip 5555");
//				  acmdService.doCmd("adb  connect " + finalIp +":5555");
//				 System.out.println("连接成功");
//			  }).start();
//
//		 }
//
//		 System.out.println(ip);
//		 String finalIp = ip ;
//		 if(ip.length()>0){
//			 AccountLog(finalIp, "获取ip地址:"+ finalIp);
//			 return ResultUtils.ResultOk( ip );
//		 }
//		 return ResultUtils.ResultErr("未找到ip,请按连接步骤重新获取。");
//
//	 }


	 /**
	  * 获取截图
	  *
	  * @param
	  * @return
	  */
	 @AutoLog(value = "实体手机管理-获取截图")
	 @ApiOperation(value="实体手机管理-获取截图", notes="实体手机管理-获取截图")
	 @PostMapping(value = "/getScreen")
	 public JSONObject getScreen(@RequestBody PhoneEntity phoneEntity ) {

		 final  String   phoneEntityId = phoneEntity.getId();
//		 PhoneEntityCmdMapper phoneEntityCmdMapper = SpringContextUtil.getBean(PhoneEntityCmdMapper.class);
//		 PhoneEntityCmd cmdStr = new PhoneEntityCmd().setEntityId(phoneEntity.getId())
//				 .setCmdStatus("0").setCmdStr("cmdStr");
//		 int insert = phoneEntityCmdMapper.insert(cmdStr	 );
//		 System.out.println(cmdStr.getId());

//		 new Thread(( )->{
//			 String rnd = phoneEntityId + RandomUtil.randomString(6);
//			 cmdBy4G(phoneEntityId,"screencap -p /sdcard/screenshot_"+rnd+".png");
//			 cmdBy4G(phoneEntityId,"smallSdcardPngscreenshot_"+rnd+".png");
//			 cmdBy4G(phoneEntityId,"uploadFileToServerscreenshot_"+ rnd +".png");
////			 redisUtil.set("lastScreenFileName_"+ phoneEntityId ,"screenshot_"+rnd+".png");
//		 }).start();

		 return ResultUtils.ResultOk("");

	 }

	private void cmdBy4G(String phoneEntityId,String cmdStr) {
		phoneEntityCmdService.save(new PhoneEntityCmd().setEntityId(phoneEntityId)
				.setCmdStatus("1").setCmdStr(cmdStr));
		System.out.println("插入数据库：" + cmdStr);
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			throw new RuntimeException(e);
		}
	}


//	 @AutoLog(value = "实体手机管理-远程控制")
//	 @ApiOperation(value="实体手机管理-远程控制", notes="实体手机管理-远程控制")
//	 @PostMapping(value = "/getScreenControl")
//	 public JSONObject getScreenControl(@RequestBody PhoneEntity phoneEntity ) {
//
//		 String finalIp = phoneEntity.getEntityIp();
//
//		 new Thread(( )->{
//			 acmdService.doCmd( "scrcpy.exe -s   " + finalIp +":5555  ");
//		 }).start();
//
//		 return ResultUtils.ResultOk("远程成功");
//
//	 }
//



//	 /**
//	  * testTask調度
//	  *
//	  * @param
//	  * @return
//	  */
//	 @AutoLog(value = "实体手机管理-testTask調度")
//	 @ApiOperation(value="实体手机管理-testTask調度", notes="实体手机管理-testTask調度")
//	 @PostMapping(value = "/taskTest")
//	 public JSONObject taskTest(  ) {
//		 taskService.connectAll();
//		 return ResultUtils.ResultOk("originalUrl");
//
//	 }
//

	 @AutoLog(value = "实体手机管理-testTask調度")
	 @ApiOperation(value="实体手机管理-testTask調度", notes="实体手机管理-testTask調度")
	 @PostMapping(value = "/getShellCommand")
	 public Result<?> getShellCommand( @RequestBody PhoneEntity phoneEntity  ) {
		 System.out.println("到访手机：" +phoneEntity.getId());
		 PhoneEntity byId = phoneEntityService.getById(phoneEntity.getId());
		 List<PhoneEntityCmd> phoneEntityCmdList = phoneEntityCmdService.list(new QueryWrapper<PhoneEntityCmd>().lambda()
				 .eq(PhoneEntityCmd::getEntityId, phoneEntity.getId())
				 .eq(PhoneEntityCmd::getCmdStatus,"1")
				 .orderByAsc(PhoneEntityCmd::getCreateTime)
				 .last("limit 1")
		 );
		 System.out.println("是否有命令给到访手机：" +phoneEntityCmdList.size());
		 updateEntityStatus(phoneEntity);
		 if(phoneEntityCmdList.size()>0){
			 PhoneEntityCmd phoneEntityCmd = phoneEntityCmdList.get(0);
			 phoneEntityCmd.setCmdStatus("0");
			 phoneEntityCmdService.updateById(phoneEntityCmd);
			 System.out.println("收到来自"+phoneEntity.getId() + "的任务查询请求，并返回： " + phoneEntityCmd.getCmdStr());
			 return Result.ok(phoneEntityCmd.getCmdStr());
		 }
		 System.out.println("收到来自"+phoneEntity.getId() + "的任务查询请求，并返回：AreYouOK");
		 return  Result.ok("input keyevent 82");
//		 input keyevent 25
//
//		 KEYCODE_CALL 进入拨号盘 5
//		 KEYCODE_ENDCALL 挂机键 6
//		 KEYCODE_HOME 按键Home 3
//		 KEYCODE_MENU 菜单键 82
//		 KEYCODE_BACK 返回键 4
//		 KEYCODE_SEARCH 搜索键 84
//		 KEYCODE_CAMERA 拍照键 27
//		 KEYCODE_FOCUS 拍照对焦键 80
//		 KEYCODE_POWER 电源键 26
//		 KEYCODE_NOTIFICATION 通知键 83
//		 KEYCODE_MUTE 话筒静音键 91
//		 KEYCODE_VOLUME_MUTE 扬声器静音键 164
//		 KEYCODE_VOLUME_UP 音量增加键 24
//		 KEYCODE_VOLUME_DOWN 音量减小键 25
//
//		 控制键
//
//		 KEYCODE_ENTER 回车键 66
//		 KEYCODE_ESCAPE ESC键 111
//		 KEYCODE_DPAD_CENTER 导航键 确定键 23
//		 KEYCODE_DPAD_UP 导航键 向上 19
//		 KEYCODE_DPAD_DOWN 导航键 向下 20
//		 KEYCODE_DPAD_LEFT 导航键 向左 21
//		 KEYCODE_DPAD_RIGHT 导航键 向右 22
//		 KEYCODE_MOVE_HOME 光标移动到开始键 122
//		 KEYCODE_MOVE_END 光标移动到末尾键 123
//		 KEYCODE_PAGE_UP 向上翻页键 92
//		 KEYCODE_PAGE_DOWN 向下翻页键 93
//		 KEYCODE_DEL 退格键 67
//		 KEYCODE_FORWARD_DEL 删除键 112
//		 KEYCODE_INSERT 插入键 124
//		 KEYCODE_TAB Tab键 61
//		 KEYCODE_NUM_LOCK 小键盘锁 143
//		 KEYCODE_CAPS_LOCK 大写锁定键 115
//		 KEYCODE_BREAK Break/Pause键 121
//		 KEYCODE_SCROLL_LOCK 滚动锁定键 116
//		 KEYCODE_ZOOM_IN 放大键 168
//		 KEYCODE_ZOOM_OUT 缩小键 169
//
//		 利用命令“adb shell input keyevent <键值>”可以实现自动化。例如“adb shell input keyevent 3”就可以按下Home键。]
//
//		 执行返回：adb shell input keyevent 4
//		 自媒体培训
//
//		 执行灭屏亮屏：adb shell input keyevent 26
//		 执行解锁屏幕：adb shell input keyevent 82
//		 return "###AreYouOK";
//		 return "app_process -Djava.class.path=/data/local/tmp/classes.dex /system/bin curlMan.Main get "+  phoneEntity.getId();
//		 return "curl http://api.hnylbigdata.com:8080/spring-boot/phone/phoneEntity/updateEntityStatus?id=" + phoneEntity.getId();
//		 return "###AreYouOK";

	 }





	 public void updateEntityStatus(PhoneEntity phoneEntity  ) {

		 PhoneEntity byId = phoneEntityService.getById(phoneEntity.getId());

		 if(byId!=null  && byId.getEntityStatus().equals(EntityEnums.EntityStatus.OFFLINE.getName())){
		 	byId.setEntityStatus(EntityEnums.EntityStatus.ONLINE.getName());
		 }
		 if(byId!=null){
			 phoneEntityService.updateById(byId);
			 System.out.println("手机主动更新了状态-----------------" +  byId.getId() + byId.getEntityStatus() );
		 }



	 }


	 @AutoLog(value = "实体手机管理-更新手机状态")
	 @ApiOperation(value="实体手机管理-更新手机状态", notes="实体手机管理-更新手机状态")
	 @GetMapping(value = "/updateTest")
	 public String updateTest(    ) {
		 String rnd1 = "D://"+RandomUtil.randomString(6)+".jpg" ;
		 String rnd2 = "D://"+RandomUtil.randomString(6)+".jpg" ;
		 ImageUtils.downLoadImg("https://ylphone.oss-cn-hangzhou.aliyuncs.com/upload/2022/10/fnrdulvgunt3t0k.png",rnd1);
		 ImageUtils.downLoadImg("https://ylphone.oss-cn-hangzhou.aliyuncs.com/upload/rightPng/a4/a4_01.png",rnd2);
//		 float percent = PhotoDigest.compare(getData(rnd1),getData(rnd2));


		 FingerPrint fp1 = null;
		 FingerPrint fp2 = null;
		 try {
			 fp1 = new FingerPrint(ImageIO.read(new File(rnd1)));
			 fp2 = new FingerPrint(ImageIO.read(new File(rnd2)));
		 } catch (IOException e) {
			 throw new RuntimeException(e);
		 }
		 float percent = fp1.compare(fp2) * 100 ;
//				 System.out.println(fp1.toString(true));
//		 System.out.printf("sim=%f",fp1.compare(fp2));

		 return "update phoneEntity  status ok"  + percent  ;



	 }



	@AutoLog(value = "实体手机管理-安装脚本")
	@ApiOperation(value="实体手机管理-安装脚本", notes="实体手机管理-安装脚本")
	@PostMapping(value = "/install")
	public void install(@RequestBody PhoneEntity phoneEntity,HttpServletRequest request, HttpServletResponse response) throws IOException {

		String rnd1 =  phoneEntity.getId() + "_" + RandomUtil.randomString(6)+".bat" ;
//		//使用方法
//		//		http://localhost:8080/common/download/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg}
		File file = new File(rnd1);
		FileWriter fw = new FileWriter(file.getAbsoluteFile());
		BufferedWriter bw = new BufferedWriter(fw);
		bw.write("start d://phonedriver//install.bat " + phoneEntity.getId());
		bw.close();


		InputStream inputStream = null;
		OutputStream outputStream = null;

		if (file.exists()) {
			response.setContentType("application/force-download");
			response.setHeader("Access-Control-Expose-Headers","Content-Disposition");
			response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1"));
			inputStream = new BufferedInputStream(new FileInputStream(file));
			outputStream = response.getOutputStream();
			byte[] buf = new byte[1024];
			int len;
			while ((len = inputStream.read(buf)) > 0) {
				outputStream.write(buf, 0, len);
			}
			response.flushBuffer();
		}
		if (inputStream != null) {
			try {
				inputStream.close();
			} catch (IOException e) {
				log.error(e.getMessage(), e);
			}
		}
		if (outputStream != null) {
			try {
				outputStream.close();
			} catch (IOException e) {
				log.error(e.getMessage(), e);
			}
		}





	}







	 private void AccountLog(String finalIp, String msg) {
		 phoneAccountLogService.save(new PhoneAccountLog() 
				 .setAccountId(finalIp)
				 .setUpdateBy(sysUtils.serverName) 
				 .setLogMsg(msg));
	 }


	 private void sleepSecond(Integer n,String msg) {
		 try {
			 System.out.println(msg);
			 Thread.sleep(1000*n);
		 } catch (InterruptedException e) {
			 throw new RuntimeException(e);
		 }
	 }







//
//	/**
//	 * 编辑
//	 *
//	 * @param phoneEntity
//	 * @return
//	 */
//	@AutoLog(value = "实体手机管理-编辑")
//	@ApiOperation(value="实体手机管理-编辑", notes="实体手机管理-编辑")
//	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
//	public Result<?> edit(@RequestBody PhoneEntity phoneEntity) {
//		phoneEntityService.updateById(phoneEntity);
//		return Result.OK("编辑成功!");
//	}
//
//	/**
//	 * 通过id删除
//	 *
//	 * @param idsVo
//	 * @return
//	 */
//	@AutoLog(value = "实体手机管理-通过id删除")
//	@ApiOperation(value="实体手机管理-通过id删除", notes="实体手机管理-通过id删除")
//	@PostMapping(value = "/delete")
//	public Result<?> delete(@RequestBody IdsVo idsVo) {
//
//		phoneEntityService.removeById(idsVo.getId());
//		return Result.OK("删除成功!");
//	}

	/**
	 * 批量删除
	 *
	 * @param idsVo
	 * @return
	 */
	@AutoLog(value = "实体手机管理-批量删除")
	@ApiOperation(value="实体手机管理-批量删除", notes="实体手机管理-批量删除")
	@PostMapping(value = "/deleteBatch")
	public Result<?> deleteBatch(@RequestBody IdsVo idsVo) {
		this.phoneEntityService.removeByIds(Arrays.asList(idsVo.getIds().split(",")));
		return Result.OK("批量删除成功！");
	}

//	/**
//	 * 通过id查询
//	 *
//	 * @param id
//	 * @return
//	 */
//	@AutoLog(value = "实体手机管理-通过id查询")
//	@ApiOperation(value="实体手机管理-通过id查询", notes="实体手机管理-通过id查询")
//	@GetMapping(value = "/queryById")
//	public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
//		PhoneEntity phoneEntity = phoneEntityService.getById(id);
//		return Result.OK(phoneEntity);
//	}
//
//  /**
//   * 导出excel
//   *
//   * @param request
//   * @param phoneEntity
//   */
//  @RequestMapping(value = "/exportXls")
//  public ModelAndView exportXls(HttpServletRequest request, PhoneEntity phoneEntity) {
//      return super.exportXls(request, phoneEntity, PhoneEntity.class, "实体手机管理");
//  }
//
//  /**
//   * 通过excel导入数据
//   *
//   * @param request
//   * @param response
//   * @return
//   */
//  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
//  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
//      return super.importExcel(request, response, PhoneEntity.class);
//  }

}
